package com.lyb.constant;

import com.lyb.command.AlpacaCommand;
import com.lyb.command.impl.*;
import com.lyb.hardware.AlpacaMainBoard;
import com.lyb.statement.ExecutableStatement;
import com.lyb.statement.impl.AdditionStatement;
import com.lyb.statement.impl.AssignStatement;
import com.lyb.statement.impl.DeviceStatement;
import com.lyb.statement.impl.SubtractionStatement;

import java.util.ArrayList;
import java.util.List;

/**
 * 常量类
 *
 * @author Mr.Alpaca potato Dayun ahuang Zheng
 * @version 1.4.0
 */
public class SystemConstant {
    /* ********** 时间 ********** */
    /**
     * 系统启动时间
     */
    public static final long SYSTEM_START_TIME = System.currentTimeMillis();
    /**
     * 进程时间片(秒)
     */
    public static final int PROCESS_TIME = 5;


    /* ********** 数量 ********** */
    /**
     * 可用设备A的数量
     */
    public static final int DEVICE_A_NUM = 1;
    /**
     * 可用设备B的数量
     */
    public static final int DEVICE_B_NUM = 2;
    /**
     * 可用设备C的数量
     */
    public static final int DEVICE_C_NUM = 2;


    /* ********** 服务 ********** */
    /**
     * 命令服务类列表
     */
    public static final List<AlpacaCommand> ALPACA_COMMANDS = new ArrayList<>();
    /**
     * 可执行语句服务类列表
     */
    public static final List<ExecutableStatement> EXECUTABLE_STATEMENT_LIST = new ArrayList<>();
    /**
     * 主板
     */
    public static final AlpacaMainBoard MAIN_BOARD = new AlpacaMainBoard();


    /* ********** 标识 ********** */
    /**
     * 系统默认磁盘文件路径
     */
    public final static String DISK_PATH = "disk";
    /**
     * 系统输出文件路径
     */
    public static final String SYSTEM_OUTPUT_PATH = "out";
    /**
     * 系统日志文件路径
     */
    public static final String SYSTEM_LOG_PATH = "log";
    /**
     * 可执行文件文件类型(后缀名)
     */
    public static final String EXECUTABLE_FILE_TYPE = "e";
    /**
     * 可执行文件终止语句
     */
    public static final String END = "end";
    /**
     * 屏幕输入文件结束标志
     */
    public static final String FILE_END = "EOF";
    /**
     * 文件可读属性
     */
    public static final String FILE_READ = "r";
    /**
     * 文件可读写属性
     */
    public static final String FILE_WRITE = "w";


    static {
        /* 初始化命令服务类列表 */
        ALPACA_COMMANDS.add(new CopyCommand());
        ALPACA_COMMANDS.add(new ECommand());
        ALPACA_COMMANDS.add(new CreateCommand());
        ALPACA_COMMANDS.add(new TypeCommand());
        ALPACA_COMMANDS.add(new ShutdownCommand());
        ALPACA_COMMANDS.add(new DeleteCommand());
        ALPACA_COMMANDS.add(new AlpCommand());
        ALPACA_COMMANDS.add(new ChangeCommand());
        ALPACA_COMMANDS.add(new ResultCommand());
        ALPACA_COMMANDS.add(new FdiskCommand());
        ALPACA_COMMANDS.add(new FormatCommand());
        ALPACA_COMMANDS.add(new MkdirCommand());
        ALPACA_COMMANDS.add(new ChdirCommand());
        ALPACA_COMMANDS.add(new RmdirCommand());
        ALPACA_COMMANDS.add(new DeldirCommand());
        ALPACA_COMMANDS.add(new MoveCommand());
        ALPACA_COMMANDS.add(new ZhengCommand());
        ALPACA_COMMANDS.add(new ClearCommand());
        ALPACA_COMMANDS.add(new TaskListCommand());
        ALPACA_COMMANDS.add(new AhuangCommand());
        ALPACA_COMMANDS.add(new CurlCommand());
        ALPACA_COMMANDS.add(new PotatoCommand());
        ALPACA_COMMANDS.add(new LogCommand());

        /* 初始化可执行语句服务类列表 */
        EXECUTABLE_STATEMENT_LIST.add(new AssignStatement());
        EXECUTABLE_STATEMENT_LIST.add(new AdditionStatement());
        EXECUTABLE_STATEMENT_LIST.add(new SubtractionStatement());
        EXECUTABLE_STATEMENT_LIST.add(new DeviceStatement());
    }
}
